#include "GunListWidget.h"





GunListWidget::GunListWidget(QWidget *parent):
    QListWidget(parent)
{

}

void GunListWidget::update_data(unordered_map<unsigned int, GunInfo::GUN_DESC> &data)
{
    this->clear();
    for (auto item = data.begin();item != data.end();item++) {
        this->addItem(new GunItem(item));
    }
}

GunItem::GunItem(unordered_map<unsigned int,GunInfo::GUN_DESC>::iterator iter):iterator(iter)
{
    this->setText(iterator->second.name.c_str());
}
